﻿using System;
using ProjScan.RecordManager;
using ProjScan.RecordManager.AssetData;
using ProjScan.ScanRule.Attr;
using UnityEngine;

namespace ProjScan.ScanRule.ProjectAssets.Texture2D
{
	// Token: 0x020001BA RID: 442
	[TextureRuleAttr]
	internal class Texture_AlphaAllOne : RecordRuleImp<TextureAssetData, TextureRecordManager>
	{
		// Token: 0x06000E7D RID: 3709 RVA: 0x0000729C File Offset: 0x0000549C
		public Texture_AlphaAllOne()
		{
			TextureAssetData.globalBool1 = true;
		}

		// Token: 0x06000E7E RID: 3710 RVA: 0x00041F38 File Offset: 0x00040138
		protected override bool IsOK(TextureAssetData assetData)
		{
			return assetData.textureFormat.ToString().Contains("ASTC") || assetData.textureFormat.ToString().Contains("ETC2") || !assetData.isTexture2D || !assetData.hasAlpha || !this.ProcessAlphaAllOne(assetData.textureColorArray, assetData.width, assetData.height);
		}

		// Token: 0x06000E7F RID: 3711 RVA: 0x00041FB4 File Offset: 0x000401B4
		private bool ProcessAlphaAllOne(Color32[] colors, int width, int height)
		{
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					int num = i * width + j;
					bool flag = colors[num].a < byte.MaxValue;
					if (flag)
					{
						return false;
					}
				}
			}
			return true;
		}
	}
}
